package com.mall.entity;

import lombok.Data;
import java.time.LocalDateTime;

/**
 * 用户实体
 * 
 * @author Mall Team
 */
@Data
public class User {
    
    private Long id;
    private String username;
    private String password;
    private String phone;
    private String email;
    private String nickname;
    private String avatar;
    private Integer userType;  // 1-普通用户 2-商家 3-管理员
    private Integer status;    // 1-正常 0-禁用
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    
    /**
     * 用户类型枚举
     */
    public enum UserType {
        NORMAL(1, "普通用户"),
        MERCHANT(2, "商家"),
        ADMIN(3, "管理员");
        
        private final Integer code;
        private final String desc;
        
        UserType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
        
        public Integer getCode() {
            return code;
        }
        
        public String getDesc() {
            return desc;
        }
    }
    
    /**
     * 用户状态枚举
     */
    public enum Status {
        DISABLED(0, "禁用"),
        ENABLED(1, "正常");
        
        private final Integer code;
        private final String desc;
        
        Status(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
        
        public Integer getCode() {
            return code;
        }
        
        public String getDesc() {
            return desc;
        }
    }
}